import 'package:flutter/material.dart';
import 'package:online_study/base/app_title.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//用户信息详情
class UserDetailsPage extends StatefulWidget {
  @override
  _UserDetailsPageState createState() => _UserDetailsPageState();
}

class _UserDetailsPageState extends State<UserDetailsPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ThemeColor.colorWhite,
      appBar: AppBar(
        leading: BackButton(color: ThemeColor.color333333),
        titleSpacing: 0,
        elevation: ThemeSize.appElevation,
        backgroundColor: ThemeColor.colorWhite,
        title: AppTitle("个人信息"),
      ),
      body: Column(
        children: [
          Container(
            width: double.infinity,
            padding: EdgeInsets.symmetric(vertical: ThemeSize.height40),
            child: Container(
              height: ThemeSize.height80,
              width: ThemeSize.height80,
              decoration: BoxDecoration(
                image: DecorationImage(
                    image: NetworkImage(
                        "https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg"),
                    fit: BoxFit.scaleDown),
                shape: BoxShape.circle,
              ),
            ),
          ),
          _buildInfo("姓名", "朱亚文"),
          _buildInfo("账户", "WB1688"),
          _buildInfo("手机号", "187-1688-1688")
        ],
      ),
    );
  }

  Widget _buildInfo(String left, String right) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: ThemeSize.width19),
      child: Column(
        children: [
          Container(
            height: ThemeSize.height45,
            width: double.infinity,
            child: Row(
              children: [
                Container(
                  width: ThemeSize.width80,
                  child: Text(left,
                      style: TextStyle(
                          color: ThemeColor.color333333,
                          fontSize: ThemeSize.sp14)),
                ),
                Text(right,
                    style: TextStyle(
                        color: ThemeColor.color808080,
                        fontSize: ThemeSize.sp13))
              ],
            ),
          ),
          Divider(height: ThemeSize.width1)
        ],
      ),
    );
  }
}
